package com.shao.im.controller;

import com.shao.commons.aspect.annotation.GetUser;
import com.shao.commons.utils.AuthUtils;
import com.shao.im.entity.Student;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/test")
@Slf4j
@Validated
public class TestController {

    /**
     * 形参校验测试
     * @return
     */
    @RequestMapping("/query1")
    @GetUser
    public String test() {
        Integer uid = AuthUtils.get();
        log.debug("查询方法触发.. - {}", uid);
        return "success";
    }

    /**
     * 对象校验测试
     * @param student
     * @return
     */
    @RequestMapping("/query2")
    public String test(Student student) {
        log.debug("查询方法触发.. - {}", student);
        return "success";
    }
}
